<!--
 * @Author: ZhaoZhiqi
 * @Date: 2022-10-24 10:39:22
 * @LastEditors: ZhaoZhiqi
 * @LastEditTime: 2022-10-24 11:18:55
 * @Description: 通办清单
 * @FilePath: \tuanfeng-mini\src\pages\trans_pro_list.vue
-->
<template>
    <div class="container">
        <template v-if="!loading && list.length">
            <div class="item" v-for="item in list">
                <div class="left" @click="toPage('pages/trans_pro_detail', { id: item.id, title: item.name })">
                    <div class="name">{{item.name}}</div>
                </div>
            </div>
        </template>
        <Empty v-if="!loading && !list.length"></Empty>
    </div>
</template>
<script>
import Empty from "../components/Empty.vue";
import { getInventoryListAPI } from "../api/trans_pro";

export default {
    components: { Empty },
    data() {
        return {
            loading: false,
            list: [],
        };
    },
    onShareAppMessage() {},
    onShow() {
        this.loading = true;
        wx.showLoading({
            title: "加载中...",
        });
        getInventoryListAPI().then((res) => {
            this.list = res.data;
            wx.hideLoading();
            this.loading = false;
        });
    },
    methods: {
        toPage(url, params) {
            this.$u.route({
                url,
                params,
            });
        },
    },
};
</script>
<style scoped lang="scss">
@import "../assets/scss/common.scss";

.container {
    min-height: 100vh;
    background-color: #fafafa;
    box-sizing: border-box;
    padding: 15px;
    .item {
        padding: 15px;
        display: flex;
        border-radius: 8px;
        background-color: #fff;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1) !important;
        .left {
            flex: auto;
            display: flex;
            align-items: center;
            .name {
                font-size: 18px;
                font-weight: bold;
                color: #0c92ff;
            }
        }
    }
}
</style>